home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
60914
/
60914.xpi
/
chrome
/
content
/
setdesktopbackgroundoverlay.js
< prev
next >
Wrap
Text File
|
2010-01-20
|
3KB
|
79 lines
var setDesktopBackgroundOverlay={
DOMContentLoaded:function(event){
setDesktopBackgroundOverlay.STRINGS=document.getElementById("overlayBundle");
},
load:function(event){
if(window.arguments[1]){
var edit=window.arguments[1].edit;
var collection=window.arguments[1].collection;
if(collection) document.getElementsByClassName("personasrotatorgroupbox")[0].removeAttribute("hidden");
if(edit){
setTimeout(function(self) {
var color = window.arguments[1].backgroundcolor;
const rMask = 4294901760;
const gMask = 65280;
const bMask = 255;
var r = (color & rMask) >> 16;
var g = (color & gMask) >> 8;
var b = (color & bMask);
gSetBackground.updateColor(gSetBackground._rgbToHex(r, g, b));
var colorpicker = document.getElementById("desktopColor");
colorpicker.color = gSetBackground._backgroundColor;
var position=window.arguments[1].position;
if(position=="CENTER") document.getElementById("menuPosition").selectedIndex=0;
else if(position=="TILE") document.getElementById("menuPosition").selectedIndex=1;
else if(position=="STRETCH") document.getElementById("menuPosition").selectedIndex=2;
gSetBackground._image = window.arguments[0];
gSetBackground._canvas.width = gSetBackground._canvas.clientWidth;
gSetBackground._canvas.height = gSetBackground._canvas.clientHeight;
var ctx = gSetBackground._canvas.getContext("2d");
ctx.scale(gSetBackground._canvas.clientWidth / gSetBackground._screenWidth, gSetBackground._canvas.clientHeight / gSetBackground._screenHeight);
gSetBackground.updatePosition();
}, 0, this);
document.documentElement.getButton("accept").label=setDesktopBackgroundOverlay.STRINGS.getString("saveChanges");
document.documentElement.setAttribute("ondialogaccept","setDesktopBackgroundOverlay.saveChanges(event);");
document.documentElement.setAttribute("title",setDesktopBackgroundOverlay.STRINGS.getString("editPersona"));
//alert(document.getAnonymousNodes(document.documentElement)[1].childNodes.length)
}
}
},
saveChanges:function(event){
var backgroundColor=gSetBackground._hexStringToLong(gSetBackground._backgroundColor);
var position=gSetBackground._position;
var editchanges={position:position,backgroundcolor:backgroundColor}
window.opener.PersonasWindow.saveEditPersonaChangesGlobally(window.arguments[1].filename,editchanges,null)
},
STRINGS:null,
}
window.addEventListener("DOMContentLoaded",setDesktopBackgroundOverlay.DOMContentLoaded,false);
window.addEventListener("load",setDesktopBackgroundOverlay.load,false);